package com.xbongbong.workflow.domain.dao;

import com.xbongbong.workflow.domain.entity.WorkflowTaskNodeEntity;
import com.xbongbong.workflow.domain.entity.ext.WorkflowTaskNodeEntityExt;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Param;
import org.springframework.stereotype.Repository;

import java.util.HashMap;
import java.util.List;
import java.util.Map;

@Mapper
@Repository
public interface WorkflowTaskNodeDao {
    Long insert(WorkflowTaskNodeEntity entity);

    void insertBatch(List<WorkflowTaskNodeEntity> list);

    WorkflowTaskNodeEntity getByKey(@Param("key") Long key, @Param("corpid") String corpid );

    Integer update(WorkflowTaskNodeEntity entity);

    List<WorkflowTaskNodeEntity> findEntities(@Param("param") Map<String, Object> param);

    Integer getEntitiesCount(@Param("param") Map<String, Object> param);
    
    void updateBatch(List<WorkflowTaskNodeEntity> list, String corpid);
    
    List<WorkflowTaskNodeEntityExt> findExtEntities(@Param("param") Map<String, Object> param);
    
    /**
     * 特殊关联查询
     * @param param
     * @return
     */
    List<WorkflowTaskNodeEntityExt> getJoinNodeForList(@Param("param") Map<String, Object> param);
    
    List<WorkflowTaskNodeEntityExt> getLatestNodeForList(@Param("param") Map<String, Object> param);
    
    void readAllCcList(@Param("param") HashMap<String, Object> param);

    void deleteByTaskId(@Param("taskId") Long taskId, @Param("corpid") String corpid);

    void deleteByTaskIds(@Param("corpid") String corpid, @Param("taskIds") List<Long> taskIds);

    List<WorkflowTaskNodeEntityExt> getTaskCountLimit(@Param("param") Map<String, Object> param);
}